Xbasic

INET::SSLContextCreatePrivateKey Method

Syntax

Result_Flag as L = CreatePrivateKey(KeyFileName as C [, Bits as N [,Password as C]])

Arguments

KeyFileNameCharacter

The path and name of the private key file.

BitsNumeric

Default = 2048. The options are:

512
1024
2048
4096
PasswordCharacter

Default = "". The password for the private key file.

Returns

Result_FlagLogical

TRUE (.T.) if the operation was successful; otherwise FALSE (.F.).

Description

Create a private key with an optional password and write to KeyFileName. Bits must be one of 512, 1024, 2048, or 4096

Discussion

The INET::SSLContext::CreatePrivateKey() method creates a private key with an optional password.

Example

dim ctx as INET::SSLContext
if ctx.createprivatekey(FileName, Bits, Password) then
    ResultText = "Creation of key was successful"
else
    ResultText = "Error creating key: " + ctx.callresult.text 
end if
ui_msg_box("Create Private Key: " + FileName, ResultText)

See Also